package com.action.sanction;

import com.db.member.MemberManager;
import com.db.member.MemberVO;
import com.db.sancdoc.DocParamVO;
import com.db.sancdoc.VDocManager;
import com.db.sancdoc.VDocVO;
import com.db.sanction.DocTypeVO;
import com.db.sanction.DocumentManager;
import com.opensymphony.xwork2.ActionContext;
import com.sun.org.apache.bcel.internal.generic.NEW;

import java.util.*;

public class MyEndAction {
	private int memno;

	private int doccount;
	private int totalpage;
	private int curpage;
	private DocParamVO paramVo = new DocParamVO();

	ArrayList<VDocVO> list = new ArrayList<VDocVO>();
	MemberVO vo = new MemberVO();
	ArrayList<DocTypeVO> dtlist = new ArrayList<DocTypeVO>();

	public int getCurpage() {
		return curpage;
	}

	public void setCurpage(int curpage) {
		this.curpage = curpage;
	}

	public int getDoccount() {
		return doccount;
	}

	public int getTotalpage() {
		return totalpage;
	}

	public ArrayList<DocTypeVO> getDtlist() {
		return dtlist;
	}

	public MemberVO getVo() {
		return vo;
	}

	public void setMemno(int memno) {
		this.memno = memno;
	}

	public ArrayList<VDocVO> getList() {
		return list;
	}

	public String execute() throws Exception {
memno = Integer.parseInt((String) ActionContext.getContext().getSession().get("memno"));//////////////////////////////////////////////////

		System.out.println(memno);

		System.out.println("myendaction");

	
		dtlist = (ArrayList<DocTypeVO>) DocumentManager.getDoctype();

		
		
vo = MemberManager.memberData(memno);

paramVo = getDocParam(memno, curpage);
list = VDocManager.decidedDocList(paramVo);



doccount = VDocManager.myDecideCount(memno);
totalpage = ((doccount-1) / 10) + 1;
		
		
		
		
		return "success";
	}
	
	public DocParamVO getDocParam(int memno, int curpage) {
		DocParamVO vo = new DocParamVO();
		vo.setMemno(memno);
		vo.setBegin((curpage * 10) - 9);
		vo.setEnd(curpage * 10);
		

		return vo;
	}
}
